//
//  TravelListTableUPHeaderView.m
//  VTravel
//
//  Created by lanouhn on 16/8/5.
//  Copyright © 2016年 xiaoYu. All rights reserved.
//

#import "TravelListTableUPHeaderView.h"

@implementation TravelListTableUPHeaderView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
 
        [self creatSearchController];
        
    }
    return self;
}

#pragma mark --  配置搜索视图控制器
- (void)creatSearchController{
    
    // UISearchController 初始化
    // ViewController *vc = [[ViewController alloc] init];
    self.searchVC = [[UISearchController alloc] initWithSearchResultsController:nil];
    
    // 属性1.searchResultsController搜索结果控制器，是个只读的，不能像下面一样进行修改！！会报错
    // self.searchVC.searchResultsController = vc;// 这样写是错误的
    NSLog(@"%@", self.searchVC.searchResultsController); // 可以读取或者打印
    
    // 属性2.UISearchResultsUpdating协议
    self.searchVC.searchResultsUpdater = self;
    // 属性3.UISearchControllerDelegate协议
    self.searchVC.delegate = self;
    // 属性4.active
    //    self.searchVC.active = NO;
    // 属性5.用来表示在搜索底层内容是否变暗。默认为YES，
    self.searchVC.dimsBackgroundDuringPresentation = NO;// 8.0之后
    // 属性6.instead dimsBackgroundDuringPresentation
    self.searchVC.obscuresBackgroundDuringPresentation = NO;// 9.1之后
    // 属性7.一个布尔值表示搜索时是否应该隐藏导航栏。
    self.searchVC.hidesNavigationBarDuringPresentation = YES;
    // 属性8.搜索栏属性
    self.searchVC.searchBar.barTintColor = [UIColor yellowColor];
    
    // 将搜索栏作为表视图的表头视图
//    self.tableView.tableHeaderView = self.searchVC.searchBar;
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
